<?php
// Begin code allow show tag <br /> & <p> in TinyMCE
function tadv_mce_options($init) {
	$init['apply_source_formatting'] = true;
	return $init;
}
function tadv_htmledit($c) {
	$c = str_replace( array('&amp;', '&lt;', '&gt;'), array('&', '<', '>'), $c );
	$c = wpautop($c);
	$c = htmlspecialchars($c, ENT_NOQUOTES);
	return $c;
}
function tmce_replace() {
	?>
	<script type="text/javascript">
	if ( typeof(jQuery) != 'undefined' ) {
		jQuery('body').bind('afterPreWpautop', function(e, o){
			o.data = o.unfiltered
			.replace(/caption\]\[caption/g, 'caption] [caption')
			.replace(/<object[\s\S]+?<\/object>/g, function(a) {
				return a.replace(/[\r\n]+/g, ' ');
			});
		}).bind('afterWpautop', function(e, o){
			o.data = o.unfiltered;
		});
	}
	</script>
	<?php 
}
add_filter('tiny_mce_before_init', 'tadv_mce_options');
add_filter('htmledit_pre', 'tadv_htmledit', 999);
add_action('after_wp_tiny_mce', 'tmce_replace');
// End`
?>